﻿using System.Reflection;
using CsvSerializer.CsvWriter;

namespace CsvSerializer
{
    /// <summary>
    /// Options for the <see cref="CsvWriter"/>.
    /// </summary>
    public class CsvWriterOptions
    {
        private char delimiter = ',';
        private bool hasHeaderRecord = true;
        private BindingFlags propertyBindingFlags = BindingFlags.Public | BindingFlags.Instance;
        private char quote = '"';
        private string dateFormat = @"yyyy-MM-dd";

        /// <summary>
        /// Gets or sets the delimiter used when
        /// writing the CSV file.
        /// </summary>
        public char Delimiter
        {
            get { return delimiter; }
            set { delimiter = value; }
        }

        /// <summary>
        /// Gets or sets the quote used to quote fields.
        /// </summary>
        public char Quote
        {
            get { return quote; }
            set { quote = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating a header
        /// record should be written to the CSV file.
        /// </summary>
        public bool HasHeaderRecord
        {
            get { return hasHeaderRecord; }
            set { hasHeaderRecord = value; }
        }

        /// <summary>
        /// Gets or sets the property binding flags.
        /// This determines what properties on the custom
        /// class are used when writing records. Default
        /// is Public | Instance.
        /// </summary>
        public BindingFlags PropertyBindingFlags
        {
            get { return propertyBindingFlags; }
            set { propertyBindingFlags = value; }
        }

        /// <summary>
        /// Gets or sets the date format
        /// </summary>
        public string DateFormat
        {
            get { return dateFormat; }
            set { dateFormat = value; }
        }
    }
}